package com.iu.eblood.daoImpl;

import java.util.List;

import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.iu.eblood.dao.GenericDao;
import com.iu.eblood.daoInterfaces.InstitutionDonationInfoDao;
import com.iu.eblood.model.Institutiondonationinfo;

@Repository("InstitutionDonatationInfoDaoImpl")
public class InstitutionDonatationInfoDaoImpl
extends GenericDao<Institutiondonationinfo,Long>
implements InstitutionDonationInfoDao{

	public InstitutionDonatationInfoDaoImpl() {
		super(Institutiondonationinfo.class);
	    
	}

	public List<Institutiondonationinfo> getBloodDonationCenters() {
		
		Session session=getHibernateTemplate().getSessionFactory().getCurrentSession();
		List<Institutiondonationinfo> lst=
				session.createQuery("from Institutiondonationinfo as InsD " +
						"where isblooddonationcenter=:IsDonation").
						setString("IsDonation", "1").list(); 
		
		return lst;
	}

	public List<Institutiondonationinfo> getFinancialDonationCenters() {
		
		Session session=getHibernateTemplate().getSessionFactory().getCurrentSession();
		List<Institutiondonationinfo> lst=
				session.createQuery("from Institutiondonationinfo as InsD " +
						"where isfinancialdonationcenter=:IsFinancial").
						setString("IsFinancial", "1").list(); 
		
		return lst;
		
	}

	public List<Institutiondonationinfo> getBloodSuppliers() {
		Session session=getHibernateTemplate().getSessionFactory().getCurrentSession();
		List<Institutiondonationinfo> lst=
				session.createQuery("from Institutiondonationinfo as InsD " +
						"where isbloodsupplier=:IsFinancial").
						setString("IsFinancial", "1").list(); 
		
		return lst;
	}
	
	

}
